package com.mpp.common.util;

import com.mpp.common.helper.JwtHelper;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName : AuthContextHolder  //类名
 * @Description : 获取当前用户信息的工具类  //描述
 * @Author : 易嵘  //作者
 * @Date: 2022-08-19 14:58  //时间
 */
public class AuthContextHolder {

    public static Long getUserId(HttpServletRequest reuest){
        String token = reuest.getHeader("toekn");
        Long userId = JwtHelper.getUserId(token);
        return userId;
    }

    public static String getUserName(HttpServletRequest reuest){
        String token = reuest.getHeader("toekn");
        String userName = JwtHelper.getUserName(token);
        return userName;
    }
}
